import type { BasicRecord } from '/@/api/model/baseModel';

export type PinRecord = {
  /** @Column({ comment: '社区id' ,nullable:true}) */
  community_id: number;
  /** @Column({ comment: '发布人id' }) */
  user_id: number;
  /** @Column({ comment: '话题id',nullable:true }) */
  topic_id: number;
  /** @Column({ type: 'text', comment: '内容' }) */
  content: string;
  /** @Column({ type: 'text', comment: '内容简化',nullable:true }) */
  brief: string;
  /** @Column({ type: 'text', comment: '图片', nullable:true }) */
  img: string;
  /** @Column({ comment: '点赞量', default: 0 }) */
  star: number;
  /** @Column({ comment: '分享量', default: 0 }) */
  share: number;
  /** @Column({ comment: '状态 0 上架 1下架', default: 0 }) */
  state: number;
  /** @Column({ comment: '推荐 0 推荐 1取消', default: 1 }) */
  recommend: number;
  /** @Column({ comment: '推荐 0 精选 1 否', default: 1 }) */
  choiceness: number;
};

export type AddPinParams = Pick<PinRecord, 'content'> &
  Partial<Pick<PinRecord, 'community_id' | 'topic_id' | 'img'>>;

export type CommentRecord = BasicRecord & {
  /** 内容 */
  content: string;
  /** 点赞量 */
  star: number;
  /** 沸点 id */
  hotspot_id: number;
  /** 评论人 id */
  user_id: number;
  /** 被评论的评论 id, 如果不是回复消息, 那么这个字段为 0 */
  to_comment_id: number;
  /** 被评论用户 id, 默认是沸点作者 */
  to_user_id: number;
  /** 多级评论需传递顶层评论的 id */
  top_id: number;

  image: string;
  stared: boolean;
};

export type AddCommentParams = Pick<CommentRecord, 'content' | 'hotspot_id'> &
  Partial<Pick<CommentRecord, 'to_comment_id' | 'to_user_id' | 'image' | 'top_id'>>;

export type AddCommentResult = {
  id: number;
};

export type AddCommentStarParams = { comment_id: number };

export type AddCommentStarResult = Pick<CommentRecord, 'star'>;

export type AddPinStarParams = { hotspot_id: number };

export type AddPinStarResult = Pick<PinRecord, 'star'>;
